package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tanhua.dubbo.mappers.AnnouncementMapper;
import com.tanhua.model.domain.Announcement;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author: Liking
 * @description
 * @date: 2023/7/29 19:27
 */
@DubboService
public class AnnouncementApiImpl implements AnnouncementApi{

    @Autowired
    private AnnouncementMapper announcementMapper;
    @Override
    public IPage<Announcement> findByPage(Integer page, Integer pagesize) {
        //1、构建分页参数对象Page
        Page pages = new Page<>(page,pagesize);
        //条件
        QueryWrapper<Announcement> queryWrapper = new QueryWrapper<>();
        //2、调用方法分页（自定义编写 分页参数Page，sql条件参数）
        return announcementMapper.selectPage(pages,queryWrapper);
//        return announcementMapper.findAnnounceList(pages);
    }
}
